package org.cos.generation.epda;

import org.cos.generation.util.predict.PredictSet;


public class Condition {
	
	public enum TargetType {
		PARAMETER,
		VARIABLE,
		STACK,
	}
	
	private TargetType type;
	
	private Integer target;
	
	private PredictSet predictSet;
	
	public Condition(TargetType type, int target, 
			PredictSet predictSet) {
		this.type = type;
		this.target = target;
		this.predictSet = predictSet;
	}
	
	public TargetType getType() {
		return type;
	}

	public Integer getTarget() {
		return target;
	}

	public PredictSet getPredictSet() {
		return predictSet;
	}
	
	public boolean isAll() {
		if (predictSet == null || predictSet.isAll()) {
			return true;
		}
		return false;
	}
	
	public boolean equals(Object o) {
		if (o instanceof Condition) {
			Condition oCond = (Condition) o;
			if (target == oCond.target &&
					type == oCond.type &&
							predictSet.equals(oCond.predictSet)) {
				return true;
			}
			return false;
		}
		return false;
	}

}
